namespace Brjnk.GpxExplorer.UI
{
    using System.Linq;

    /// <summary>
    /// </summary>
    public static class UserMessages
    {
        public static void ShowError(string message)
        {
            System.Windows.MessageBox.Show(message);
        }

        public static int? Question(string question, params string[] answers)
        {
            var window = new QuestionWindow(new Question() { Text = question }, answers.Select((a, i) => new Answer(i) { Text = a }));
            if (!window.ShowDialog().HasValue || !(window.Result is int)) return null;
            return (int)window.Result;
        }
    }

    public class Question
    {
        public string Text { get; set; }
    }

    public class Answer
    {
        public Answer(object id)
        {
            ID = id;
        }

        public string Text { get; set; }

        public object ID { get; private set; }
    }
}